<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/8/16
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.6.0.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css"/>
    <%--引入echarts--%>
    <script src="${pageContext.request.contextPath}/js/echarts.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/index.css">
    <%--    revealFull--%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/re_approve/revealFull.css">
</head>
<body>

<%@include file="../pub/header.jsp" %>
<div class="header">
    <div class="nav">
        <div class="container">

            <div class="row">
                <a class="col-md-3 col-xs-6" href="${pageContext.request.contextPath}/index">首&nbsp;页</a>
                <a class="col-md-3 col-xs-6 active" href="${pageContext.request.contextPath}/user/news">新闻资讯</a>
                <a class="col-md-3 col-xs-6" href="${pageContext.request.contextPath}/re_approve/item">办事大厅</a>
                <a class="col-md-3 col-xs-6"
                   href="${pageContext.request.contextPath}/item/revealFull">公示信息</a>
            </div>
        </div>
    </div>
</div>

<br>
<br>

<div class="container">
    <div class="l_fourth">
        <div class="row">

            <div class="title col-md-12 col-xs-12" style="float: right;background-image: url('${pageContext.request.contextPath}/img/index/Frame 11@2x.png')" >
                <span class="one" style="font-size: 24px;margin-left: 6px">  新闻资讯</span>
                <span class="two" style="color: white;margin-top: 5px; "><a onclick="next()">加载更多</a></span>
            </div>
        </div>
        <div class="clear"></div>

        <div class="row">

            <div class=" con titles" >
                <ul style="font-size: large">

                </ul>

            </div>
        </div>
    </div>


<%--    <div class="container">--%>
<%--        <div class="row">--%>
<%--            <div class="col-md-2 col-xs-2"></div>--%>

<%--            <a onclick="next()">加载更多</a>--%>

<%--        </div>--%>
<%--    </div>--%>
</div>

<%@include file="../pub/footer.jsp" %>
<script>
    var p=2
    $(function(){
        ajaxList(1);
    });
    function ajaxList(page) {

        var departId =$('#title').val();

        $.ajax({
            type : 'get',
            url : "${pageContext.request.contextPath}/user/news/queryList",
            data : {
                "page":page,

                "title":departId
            },
            success : function(result) {

                var rows = result.list;//得到数据列
                var total = result.count;//得到数据总数
                $("#lastPage").val(result.totalPage)
                lastPage=result.totalPage;
                totalCount=total;
                if (page>lastPage){
                    alert("暂无更多")
                    return
                }
                var html = $(".titles ul ").html();
                for (var i = 0; i < rows.length; i++) {
                    html += ' <li><a href="${pageContext.request.contextPath}/user/newsDetail?id='+rows[i].id+'"><span></span>' +
                        rows[i].title+'</li>'
                }
                if (rows.length == 0) {
                    html += '无数据';
                }
                $(".titles ul ").html(html);



            }
        });
    }

    function next() {
        ajaxList(p++)
    }
</script>
</body>
</html>
